<extend name="Public/base"/>

<block name="body">
    <!-- 標題欄 -->
    <div class="main-title">
        <h3>模型列表</h3>

    </div>
    <div class="btn-group m-b-sm" role="group">
        <a class="btn btn-default" href="{:U('Model/add')}">新 增</a>
        <button class="btn btn-default ajax-post" target-form="ids" url="{:U('Model/setStatus',array('status'=>1))}">啟 用</button>
        <button class="btn btn-default ajax-post" target-form="ids" url="{:U('Model/setStatus',array('status'=>0))}">禁 用</button>
        <a class="btn btn-default" href="{:U('Model/generate')}">生 成</a>
    </div>

    <!-- 數據列表 -->
    <div class="data-table">
        <div class="panel-body panel panel-default">
            <table class="table table-hover table-striped">
                <thead>
                    <tr>
                        <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                        <th class="">編號</th>
                        <th class="">標識</th>
                        <th class="">名稱</th>
                        <th class="">創建時間</th>
                        <th class="">狀態</th>
                        <th class="">操作</th>
                    </tr>
                </thead>
                <tbody>
                <notempty name="_list">
                    <volist name="_list" id="vo">
                        <tr>
                            <td><input class="ids" type="checkbox" name="ids[]" value="{$vo.id}" /></td>
                            <td>{$vo.id} </td>
                            <td>{$vo.name}</td>
                            <td><a data-id="{$vo.id}" href="{:U('model/edit?id='.$vo['id'])}">{$vo.title}</a></td>
                            <td><span>{$vo.create_time|time_format}</span></td>
                            <td>{$vo.status_text}</td>
                            <td>
                                <a href="{:U('model/setstatus?ids='.$vo['id'].'&status='.abs(1-$vo['status']))}" class="ajax-get">{$vo.status|show_status_op}</a>
                                <a href="{:U('model/edit?id='.$vo['id'])}">編輯</a>
                                <a href="{:U('model/del?ids='.$vo['id'])}" class="confirm ajax-get">刪除</a>
                            </td>
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="7" class="text-center"> aOh! 暫時還沒有內容! </td>
                </notempty>
                </tbody>
            </table>

        </div>
    </div>
    <nav>

  <ul class="pagination">

  {$_page|default=''}  

  </ul>
</nav>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#search").click(function () {
                var url = $(this).attr('url');
                var status = $('select[name=status]').val();
                var search = $('input[name=search]').val();
                if (status != '') {
                    url += '/status/' + status;
                }
                if (search != '') {
                    url += '/search/' + search;
                }
                window.location.href = url;
            });
        })
    </script>
</block>
